package cn.outsourcing.supermarket.service.impl;

import cn.outsourcing.supermarket.converter.HiolabsGoodsGalleryConverter;
import cn.outsourcing.supermarket.mapper.HiolabsGoodsGalleryMapper;
import cn.outsourcing.supermarket.po.HiolabsGoodsGallery;
import cn.outsourcing.supermarket.service.HiolabsGoodsGalleryService;
import cn.outsourcing.supermarket.vo.hiolabs.HiolabsGalleryVO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 服务实现类
 *
 * @author gzkemays
 * @since 2021-10-14
 */
@Service
public class HiolabsGoodsGalleryServiceImpl
    extends ServiceImpl<HiolabsGoodsGalleryMapper, HiolabsGoodsGallery>
    implements HiolabsGoodsGalleryService {
  @Resource HiolabsGoodsGalleryMapper galleryMapper;

  @Override
  public List<HiolabsGalleryVO> getGoodsGallery(Integer goodsId) {
    return HiolabsGoodsGalleryConverter.INSTANCE.convertToVoList(
        galleryMapper.selectList(
            Wrappers.<HiolabsGoodsGallery>lambdaQuery()
                .eq(HiolabsGoodsGallery::getGoodsId, goodsId)
                .eq(HiolabsGoodsGallery::getIsDelete, 0)));
  }
}
